using System;
using System.Collections.Generic;
using System.Windows.Media;
using Director.DomainModels;

namespace Director.Indicators
{
	public abstract class Indicator
	{
		public abstract string ShortKindName { get; }
		public string Name { get; set; }
		public Color Color { get; set; }
	}

	public abstract class StrategyIndicator : Indicator
	{
		private readonly List<decimal?> _values = new List<decimal?>();

		public Guid Identifier { get; set; }

		private DateTime _dateTime = DateTime.MinValue;

		protected abstract decimal? Calc(Candle candle);

		public void Update(Candle candle)
		{
			if (candle.Date > _dateTime)
			{
				_dateTime = candle.Date;
				var v = Calc(candle);
				_values.Add(v);
			}
		}

		public decimal? this[int index] { get { return _values[_values.Count + index-1]; } }
	}


	public abstract class ChartIndicator : Indicator
	{
		public abstract void Calc(Candle[] candles);
	}

	public abstract class SeriesChartIndicator : ChartIndicator
	{
		public decimal?[] Data { get; protected set; }
	}

	public abstract class SignChartIndicator : ChartIndicator
	{
		public Sign[] Signs { get; protected set; }
	}

	public class Sign
	{
		public DateTime DateTime { get; set; }
		public decimal Value { get; set; }
		public string Text { get; set; }
	}


	public abstract class SeriesIndicator1 : Indicator
	{
		public decimal?[] Data { get; protected set; }
	}
}